<script setup>
import { onUnmounted } from 'vue';
import { onBeforeRouteLeave } from 'vue-router';

onUnmounted(() => {
  console.log('组件卸载后');
});

// onBeforeRouteLeave((to, from, next) => {
//   console.log('路由离开');
//   next();
// });

</script>

<template>
  <div>
    首页内容
    <router-link to="/login">去登录页</router-link>
  </div>
</template>
